<template>
  <div>
    <el-dialog
      title="题目审核"
      :visible="dialogVisible"
      width="40%"
      @close="cancelfn"
    >

      <el-radio v-model="radio" label="1">通过</el-radio>
      <el-radio v-model="radio" label="2">拒绝</el-radio>
      <div class="textarea">
        <el-input v-model="textstr" type="textarea" :rows="2" placeholder="请输入审核意见" />
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="cancelfn">取 消</el-button>
        <el-button type="primary" @click="btnOK">确 定</el-button>
      </span>
    </el-dialog>

  </div>
</template>
<script>
import { choiceCheck } from '@/api/hmmm/questions.js'
export default {
  props: {
    dialogVisible: {
      type: Boolean,
      default: false
    },
    checkId: {
      type: Number,
      required: true
    }
  },
  data() {
    return {
      radio: '1',
      textstr: ''
    }
  },
  methods: {
    async btnOK() {
      if (this.textstr.trim().length > 0) {
        await choiceCheck({ id: this.checkId, chkState: Number(this.radio), chkRemarks: this.textstr })
        this.$emit('Parent')
        this.$emit('update:dialogVisible', false)
      } else {
        this.$message.warning('审核意见不能为空！')
      }
    },
    cancelfn() {
      this.$emit('update:dialogVisible', false)
      this.radio = '1'
      this.textstr = ''
    }

  }
}
</script>

<style scoped lang='scss'>
  .textarea{
    margin-top: 20px;
  }
</style>
